package io.renren.modules.hospital.controller;

import java.util.Arrays;
import java.util.Map;


import java.util.Arrays;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

import io.renren.modules.hospital.entity.EmrZyModelEntity;
import io.renren.modules.hospital.service.EmrZyModelService;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;



/**
 *
 *
 * @author starry
 * @email 2495646304@qq.com
 * @date 2024-02-16 13:28:27
 */
@RestController
@RequestMapping("hospital/emrzymodel")
@Api(value = "中医病历模板接口", tags = "中医病历模板接口")
public class EmrZyModelController {
    @Autowired
    private EmrZyModelService emrZyModelService;

    /**
     * 列表
     */
    @GetMapping("/list")
    @ApiOperation("列表")
    //@RequiresPermissions("hospital:emrzymodel:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = emrZyModelService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @GetMapping("/info/{emrZyId}")
    @ApiOperation("信息")
    //@RequiresPermissions("hospital:emrzymodel:info")
    public R info(@PathVariable("emrZyId") Integer emrZyId){
		EmrZyModelEntity emrZyModel = emrZyModelService.getById(emrZyId);

        return R.ok().put("emrZyModel", emrZyModel);
    }

    /**
     * 保存
     */
    @PostMapping("/save")
    @ApiOperation("保存")
    //@RequiresPermissions("hospital:emrzymodel:save")
    public R save(@RequestBody EmrZyModelEntity emrZyModel){
		emrZyModelService.save(emrZyModel);

        return R.ok();
    }

    /**
     * 修改
     */
    @PostMapping("/update")
    @ApiOperation("修改")
    //@RequiresPermissions("hospital:emrzymodel:update")
    public R update(@RequestBody EmrZyModelEntity emrZyModel){
		emrZyModelService.updateById(emrZyModel);

        return R.ok();
    }

    /**
     * 删除
     */
    @PostMapping("/delete")
    @ApiOperation("删除")
    //@RequiresPermissions("hospital:emrzymodel:delete")
    public R delete(@RequestBody Integer[] emrZyIds){
		emrZyModelService.removeByIds(Arrays.asList(emrZyIds));

        return R.ok();
    }

}
